//
//  UseGroup.swift
//  learn-ios
//
//  Created by Dong on 2022/4/5.
//

import SwiftUI

struct UseGroup: View {
    
    @State private var userAgreed:Bool = false
    var body: some View {
        
        VStack {
            // 组默认不会影响任何操作
            // 可以利用于批量设置属性
            Group {
                Text("SwiftUI")
                Text("Combine")
                Text("Swift System")
            }
            .font(.title)
            .padding()
            
            // 可选标签风格的组
            GroupBox{
                Text("1")
                Text("2")
                Text("3")
                Text("4")
            }
            Text("5")
            
            GroupBox(label:
                    Label("End-User Agreement", systemImage: "building.columns")
                ) {
                    ScrollView(.vertical, showsIndicators: true) {
                        Text("")
                            .font(.footnote)
                    }
                    .frame(height: 100)
                    Toggle(isOn: $userAgreed) {
                        Text("I agree to the above terms")
                    }
                }
            
            // 以视觉上适合上下文的方式显示语义相关控件的容器视图
            ControlGroup{
                Text("hello")
                Text("world")
            }
        }
    }
}

struct UseGroup_Previews: PreviewProvider {
    static var previews: some View {
        UseGroup()
    }
}
